package nl.hr.cmi.project4.inf1m.groep1.ZuinigRijden;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageView;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

public class GoogleMapView extends MapActivity {
	ArrayList<SmallLocation> locationList; 
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.viewroute);
    	locationList = LocationHolder.getOpenLocationList();
    	//Intent intent = getIntent();
    	
    	//LocationListParcel locationListParcel = (LocationListParcel)intent.getParcelableExtra("locationList");
    	//ArrayList<SmallLocation> locationList = locationListParcel.getLocationList();
    	
    	
        MapView mapView = (MapView) findViewById(R.id.mapView);
        if(mapView != null){
        	mapView.setBuiltInZoomControls(true);
        }
    	
    	List<Overlay> mapOverlays = mapView.getOverlays();
    	Drawable drawable = this.getResources().getDrawable(R.drawable.point);
    	ItemizedOverlayZR itemizedOverlay = new ItemizedOverlayZR(drawable);
    	for(int i = 0;i < locationList.size();++i){
	    	GeoPoint point = new GeoPoint((int)(locationList.get(i).getLatitude() * 1E6),(int)(locationList.get(i).getLongitude() * 1E6));
	    	OverlayItem overlayitem = new OverlayItem(point, "", "");
	    	itemizedOverlay.addOverlay(overlayitem);
    	}
    	mapOverlays.add(itemizedOverlay);
    }
	
	@Override
	protected boolean isRouteDisplayed() {
	    return false;
	}
}
